"use strict";
require("test").setup();

var Coroutine = require('coroutine');
var hash = require('hash');

describe("file", function() {
    before(function() {

    });

    after(function() {
        clearDB();
    });


    it("登录", function() {
        httpPost("GET", "/v1.0/api/user/Sync", {})

        var t = "123"
        var result = httpPost("POST", "/v1.0/api/user/WebLogin", {
            "phone": "18888888888",
            "password": hash.md5(hash.md5("ZHYQ2020").digest().hex() + t).digest().hex(),
            "t": t,
        })
        assert.equal(result.code, "200");
        assert.equal(result.data.id, 1);
    });

    it("下载文件", function() {
        var result = httpPost("GET", "/v1.0/api/file/Download/1", {})

        assert.equal(result.code, "200");
    });
});

require('test').run();